<?php
namespace common\components\ActionsComponents;
use common\models\Region\Region;


/**
 * 
 * 地区管理控制器
 * @author Administrator
 *
 */
class RegionAction extends CommonAction
{
	/**
	 * 地区联动
	 */
	public function run()
	{
        $controller = $this->controller;

		$regionModel = new Region();
		$regionModel->fields = ['region_id', 'region_name'];
		
		$arrRegionRes = $regionModel->getListAll(['parent_id'=>$this->_request[$this->_pk]]);
		
		if ( empty($arrRegionRes) ) return $controller->renderJSON(
		    $controller->jsonResponse($controller::RESPONSE_FAILURE, '未找到对应数据')
        );
		
		return $controller->renderJSON(
		    $controller->jsonResponse($controller::RESPONSE_SUCCESS, $arrRegionRes)
        );
	}	
}
